import 'package:OASys/views/announcement/announcementEdit.dart';
import 'package:OASys/views/announcement/announcementPage.dart';
import 'package:OASys/views/event/eventEdit.dart';
import 'package:OASys/views/event/eventPage.dart';
import 'package:OASys/views/home/Tabs.dart';
import 'package:OASys/views/home/messagePage.dart';
import 'package:OASys/views/home/personalInfoEdit.dart';
import 'package:OASys/views/login/loginPage.dart';
import 'package:OASys/views/login/registerPage.dart';
import 'package:OASys/views/matter/matterEdit.dart';
import 'package:OASys/views/matter/matterPage.dart';
import 'package:OASys/views/meeting/meetingDetail.dart';
import 'package:OASys/views/meeting/meetingEditPage.dart';
import 'package:OASys/views/meeting/meetingPage.dart';
import 'package:OASys/views/menu/menuPage.dart';
import 'package:OASys/views/paper/paperPage.dart';
import 'package:OASys/views/personnel/personnelPage.dart';
import 'package:OASys/views/project/projectPage.dart';
import 'package:OASys/views/report/reportPage.dart';
import 'package:OASys/views/role/roleEdit.dart';
import 'package:OASys/views/role/rolePage.dart';
import 'package:OASys/views/schedule/schedulePage.dart';
import 'package:OASys/views/user/pwdPage.dart';
import 'package:OASys/views/user/userAddPage.dart';
import 'package:OASys/views/user/userInfoEditPage.dart';
import 'package:OASys/views/user/userPage.dart';
import 'package:flutter/material.dart';

final routes = {
  '/': (context, {arguments}) => Tabs(),
  '/home': (context, {arguments}) => Tabs(),
  '/login': (context, {arguments}) => LoginPage(),
  '/register': (context, {arguments}) => RegisterPage(),
  '/message': (context, {arguments}) => MessagePage(arguments: arguments),
  '/project': (context, {arguments}) => ProjectPage(arguments: arguments),
  '/matter': (context, {arguments}) => MatterPage(),
  '/paper': (context, {arguments}) => PaperPage(),
  '/report': (context, {arguments}) => ReportPage(),
  '/meeting': (context, {arguments}) => MeetingPage(),
  '/schedule': (context, {arguments}) => SchedulePage(),
  '/announcement': (context, {arguments}) => AnnouncementPage(),
  '/menu': (context, {arguments}) => MenuPage(),
  '/role': (context, {arguments}) => Rolepage(),
  '/user': (context, {arguments}) => UserPage(),
  '/event': (context, {arguments}) => EventPage(),
  '/personnel': (context, {arguments}) => PersonnelPage(),
  '/personalInfoEdit': (context, {arguments}) =>
      PersonalInfoEdit(arguments: arguments),
  '/pwd': (context, {arguments}) => PwdPage(),
  '/userInfoEdit': (context, {arguments}) =>
      UserInfoEditPage(arguments: arguments),
  '/userAdd': (context, {arguments}) => UserAddPage(arguments: arguments),
  '/roleEdit': (context, {arguments}) => RoleEditPage(arguments: arguments),
  '/meetingEdit': (context, {arguments}) =>
      MeetingEditPage(arguments: arguments),
  '/meetingDetail': (context, {arguments}) =>
      MeetingDetail(arguments: arguments),
  '/eventEdit': (context, {arguments}) => EventEditPage(arguments: arguments),
  '/announcementEdit': (context, {arguments}) =>
      AnnouncementEditPage(arguments: arguments),
  '/matterEdit': (context, {arguments}) => MatterEditPage(arguments: arguments),
};

/// 路由跳转
MaterialPageRoute onGenerateRoute(RouteSettings settings) {
  final String name = settings.name;
  print('settings.name:' + settings.name.toString());
  var pageBuilder = routes[name];
  if (pageBuilder != null) {
    print('settings Arguments:' + settings.arguments.toString());
    if (settings.arguments != null) {
      return MaterialPageRoute(
          builder: (context) =>
              pageBuilder(context, arguments: settings.arguments));
    } else {
      return MaterialPageRoute(builder: (context) => pageBuilder(context));
    }
  }
  return null;
}
